home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 023 / ver30 / sys / msdos / spawn.c < prev    next >
C/C++ Source or Header  |  1995-03-17  |  2KB  |  72 lines

  1. /*
  2.  * Name:    MicroEMACS
  3.  *        MS-DOS spawn command.com
  4.  * Version:    29
  5.  * Last edit:    05-Feb-86
  6.  * By:        rex::conroy
  7.  *        decvax!decwrl!dec-rhea!dec-rex!conroy
  8.  */
  9. #include    "def.h"
  10.  
  11. #include    <dos.h>
  12.  
  13. #if    !LARGE
  14. char    *cspec    = NULL;                /* Command string.    */
  15. #endif
  16.  
  17. /*
  18.  * Create a subjob with a copy
  19.  * of the command intrepreter in it. When the
  20.  * command interpreter exits, mark the screen as
  21.  * garbage so that you do a full repaint. Bound
  22.  * to "C-C" and called from "C-Z".
  23.  */
  24. spawncli(f, n, k)
  25. {
  26. #if    LARGE
  27.     eprintf("Not in large model MS-DOS");
  28.     return (FALSE);
  29. #else
  30.     ttcolor(CTEXT);                /* Normal color.    */
  31.     ttwindow(0, nrow-1);            /* Full screen scroll.    */
  32.     ttmove(nrow-1, 0);            /* Last line.        */
  33.     ttflush();
  34.     if (cspec == NULL) {            /* Try to find it.    */
  35.         cspec = getenv("COMSPEC");
  36.         if (cspec == NULL)
  37.             cspec = "A:COMMAND.COM";
  38.     }
  39.     sys(cspec, "");                /* Run CLI.        */
  40.     sgarbf = TRUE;
  41.     return(TRUE);
  42. #endif
  43. }
  44.  
  45. #if    !LARGE
  46. /*
  47.  * This routine, once again
  48.  * by Bob McNamara, is a C translation
  49.  * of the "system" routine in the MWC-86 run
  50.  * time library. It differs from the "system" routine
  51.  * in that it does not unconditionally append the
  52.  * string ".exe" to the end of the command name.
  53.  * We needed to do this because we want to be
  54.  * able to spawn off "command.com". We really do
  55.  * not understand what it does, but if you don't
  56.  * do it exactly "malloc" starts doing very
  57.  * very strange things.
  58.  */
  59. sys(cmd, tail)
  60. char    *cmd;
  61. char    *tail;
  62. {
  63.     register unsigned n;
  64.     extern   char      *__end;
  65.  
  66.     n = __end + 15;
  67.     n >>= 4;
  68.     n = ((n + dsreg() + 16) & 0xFFF0) + 16;
  69.     return(execall(cmd, tail, n));
  70. }
  71. #endif
  72.